/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cnam.mobileShopping.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrateur
 */
@Entity
@Table(name = "userlist")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Userlist.findAll", query = "SELECT u FROM Userlist u"),
    @NamedQuery(name = "Userlist.findByUsermlistid", query = "SELECT u FROM Userlist u WHERE u.usermlistid = :usermlistid"),
    @NamedQuery(name = "Userlist.findByUserid", query = "SELECT u FROM Userlist u WHERE u.userid = :userid"),
    @NamedQuery(name = "Userlist.findByStatus", query = "SELECT u FROM Userlist u WHERE u.status = :status")})
public class Userlist implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "usermlistid")
    private Integer usermlistid;
    @Column(name = "status")
    private Short status;
    @JoinColumn(name = "userid", referencedColumnName = "userid")
    @ManyToOne
    private User userid;
    @JoinColumn(name = "mlistid", referencedColumnName = "mlistid")
    @ManyToOne
    private MList mlistid;
    
    @Column(name = "lastupdatedatetime")
    @XmlTransient
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date lastupdatedatetime;
    
    public MList getMlistid() {
        return mlistid;
    }

    public void setMlistid(MList mlistid) {
        this.mlistid = mlistid;
    }

    public Short getStatus() {
        return status;
    }

    public void setStatus(Short status) {
        this.status = status;
    }

    public User getUserid() {
        return userid;
    }

    public void setUserid(User userid) {
        this.userid = userid;
    }

    public Integer getUsermlistid() {
        return usermlistid;
    }

    public void setUsermlistid(Integer usermlistid) {
        this.usermlistid = usermlistid;
    }

    public Userlist() {
    }

    public Date getLastupdatedatetime() {
        return lastupdatedatetime;
    }

    public void setLastupdatedatetime(Date lastupdatedatetime) {
        this.lastupdatedatetime = lastupdatedatetime;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (usermlistid != null ? usermlistid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Userlist)) {
            return false;
        }
        Userlist other = (Userlist) object;
        if ((this.usermlistid == null && other.usermlistid != null) || (this.usermlistid != null && !this.usermlistid.equals(other.usermlistid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "NENTITY.Userlist[ usermlistid=" + usermlistid + " ]";
    }
}
